package com.servlet.users;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.dao.UsersDAO;
import com.entity.Users;

public class FindUsersByNameServlet extends HttpServlet {

	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {

		String userName = request.getParameter("user_Name");
		UsersDAO usersDAO = new UsersDAO();
		Users users = usersDAO.findByName(userName);
		request.setAttribute("users", users);

		request.getRequestDispatcher("/background/updateBookInfo.jsp").forward(
				request, response);
	}

	
	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {

		String userName = request.getParameter("user_Name");
		UsersDAO usersDAO = new UsersDAO();
		Users users = usersDAO.findByName(userName);
		request.setAttribute("users", users);

		request.getRequestDispatcher("/background/updateBookInfo.jsp").forward(
				request, response);
	}

}
